home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / hash.zip / LIST.4 < prev    next >
Text File  |  1993-01-04  |  592b  |  24 lines

  1. ;--------------------------------------------
  2. ;HASH--Procedure to hash a four byte string
  3. ;        
  4. ;    Input:    AX := first two bytes of string
  5. ;        BX := second two bytes of string
  6. ;
  7. ;    Output:    AL := hash value (0-60)
  8. ;
  9. ;    Registers destroyed:    AX,BX
  10. ;---------------------------------------------
  11. ;
  12. TAB_sz    equ    61        ;define table size
  13. hash    proc    near    
  14.     push    dx        ;save DX
  15.     xor    ax,bx        ;combine into 16 bits
  16.     xor    dx,dx        ;clear DX-dividend in DX AX
  17.     mov    bx,TAB_sz    ;table size to BX
  18.     div    bx        ;divide-remainder is in DX
  19.     mov    ax,dx        ;remainder to AX
  20.     pop    dx        ;restore DX
  21.     ret
  22. hash    endp
  23.  
  24.